!===============================================================
!
! Funzione Shekel Foxholes (n=5)
!
!===============================================================
!			VARIABLE BOUNDS
!===============================================================
!       0.D0              1.D+1          Limits of variable i
SUBROUTINE SHEKELFOX(X,N,F)

      IMPLICIT NONE

      INTEGER          :: N
      DOUBLE PRECISION :: X(N), F
	  DOUBLE PRECISION :: C(30), A(30,5)
	  DOUBLE PRECISION :: D
	  DOUBLE PRECISION, PARAMETER :: PI = 3.1415923D0
      INTEGER          :: I, J

	  DATA ((A(J,I), I=1,5), J=1,30) &
			/9.681D0, 0.667D0, 4.783D0, 9.095D0, 3.517D0,	&
			 9.400D0, 2.041D0, 3.788D0, 7.931D0, 2.882D0,	&
			 8.025D0, 9.152D0, 5.114D0, 7.621D0, 4.564D0,	&
			 2.196D0, 0.415D0, 5.649D0, 6.979D0, 9.510D0,	&
			 8.074D0, 8.777D0, 3.467D0, 1.867D0, 6.708D0,	&
			 7.650D0, 5.658D0, 0.720D0, 2.764D0, 3.278D0,	&
			 1.256D0, 3.605D0, 8.623D0, 6.905D0, 4.584D0,	&
			 8.314D0, 2.261D0, 4.224D0, 1.781D0, 4.124D0,	&
			 0.226D0, 8.858D0, 1.420D0, 0.945D0, 1.622D0,	&
			 7.305D0, 2.228D0, 1.242D0, 5.928D0, 9.133D0,	&
			 0.652D0, 7.027D0, 0.508D0, 4.876D0, 8.807D0,	&
			 2.699D0, 3.516D0, 5.874D0, 4.119D0, 4.461D0,	&
			 8.327D0, 3.897D0, 2.017D0, 9.570D0, 9.825D0,	&
			 2.132D0, 7.006D0, 7.136D0, 2.641D0, 1.882D0,	&
			 4.707D0, 5.579D0, 4.080D0, 0.581D0, 9.698D0,	&
			 8.304D0, 7.559D0, 8.567D0, 0.322D0, 7.128D0,	&
			 8.632D0, 4.409D0, 4.832D0, 5.768D0, 7.050D0,	&
			 4.887D0, 9.112D0, 0.170D0, 8.967D0, 9.693D0,	&
			 2.440D0, 6.686D0, 4.299D0, 1.007D0, 7.008D0,	&
			 6.306D0, 8.583D0, 6.084D0, 1.138D0, 4.350D0,	&
			 0.652D0, 2.343D0, 1.370D0, 0.821D0, 1.310D0,	&
			 5.558D0, 1.272D0, 5.756D0, 9.857D0, 2.279D0,	&
			 3.352D0, 7.549D0, 9.817D0, 9.437D0, 8.687D0,	&
			 8.798D0, 0.880D0, 2.370D0, 0.168D0, 1.701D0,	&
			 1.460D0, 8.057D0, 1.336D0, 7.217D0, 7.914D0,	&
			 0.432D0, 8.645D0, 8.774D0, 0.249D0, 8.081D0,	&
			 0.679D0, 2.800D0, 5.523D0, 3.049D0, 2.968D0,	&
			 4.263D0, 1.074D0, 7.286D0, 5.599D0, 8.291D0,	&
			 9.496D0, 4.830D0, 3.150D0, 8.270D0, 5.079D0,	&
			 4.138D0, 2.562D0, 2.532D0, 9.661D0, 5.611D0 /
	  DATA (C(I), I=1,30) /0.806D0, 0.517D0, 0.100D0, 0.908D0, 0.965D0, &
	                       0.669D0, 0.524D0, 0.902D0, 0.531D0, 0.876D0, &
						   0.462D0, 0.491D0, 0.463D0, 0.714D0, 0.352D0, &
						   0.869D0, 0.813D0, 0.811D0, 0.828D0, 0.964D0, &
						   0.789D0, 0.360D0, 0.369D0, 0.992D0, 0.332D0, &
						   0.817D0, 0.632D0, 0.883D0, 0.608D0, 0.326D0 /

	  F = 0.0d0 !1.D0/5.D+2

	  DO J = 1,30
		D = 0.D0
		DO I = 1,N
			D = D + X(I) - A(J,I)
		ENDDO		
		F = F - (1.D0/(C(J)+D))**2.D0
	  ENDDO

	  !F = 1.D0/F

      RETURN

END
